package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @Classname: Demo07
 * @Author: bromide
 * @CreateTime: 2022/5/10--9:22
 * @Version: V1.0
 * @Description:
 */
public class Demo07 {
    public static void main(String[] args) {
        //把英雄表的所有信息查询出来并在控制台输出
        try(Connection conn = DBUtils.getConn()) {
            Statement s = conn.createStatement();
            ResultSet set = s.executeQuery("select * from hero");
            while (set.next()){
                int id = set.getInt(1);
                String name = set.getString(2);
                int money = set.getInt(3);
                System.out.println(id+"---"+name+":"+money);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
